package meituan.bytecode.javassist;


import java.lang.management.ManagementFactory;

public class Base {
    /** 执行步骤: 1. 先执行Base类中的main方法. 获取进程号. 2. 将上面的进程号修改到 Attacher类中的main方法中. */
    public static void main(String[] args) {
        String name = ManagementFactory.getRuntimeMXBean().getName();
        System.out.println(name);
        String s = name.split("@")[0];
        // 打印当前Pid
        System.out.println("pid:" + s);
        while (true) {
            try {
                Thread.sleep(5000L);
            } catch (Exception e) {
                break;
            }
            process();
        }
    }

    public static void process() {
        System.out.println("process");
    }
}
